package com.ruoyi.zxjd.work.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.zxjd.work.domain.WorkTemplateTable7;
import com.ruoyi.zxjd.work.domain.bo.WorkProgressBO;
import com.ruoyi.zxjd.work.mapper.WorkTemplateTable7Mapper;
import com.ruoyi.zxjd.work.service.ICommonWorkTemplateTableService;
import com.ruoyi.zxjd.work.service.IWorkTemplateTable7Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 纪检监察机关立案审查调查情况登记Service业务层处理
 * 
 * @author lcc
 * @date 2021-03-04
 */
@Service
public class WorkTemplateTable7ServiceImpl implements IWorkTemplateTable7Service
{
    @Autowired
    private WorkTemplateTable7Mapper workTemplateTable7Mapper;
    @Autowired
    private WorkProgressServiceImpl workProgressService;

    @Autowired
    private ICommonWorkTemplateTableService commonWorkTemplateTableService;
    /**
     * 查询纪检监察机关立案审查调查情况登记
     * 
     * @param id 纪检监察机关立案审查调查情况登记ID
     * @return 纪检监察机关立案审查调查情况登记
     */
    @Override
    public WorkTemplateTable7 selectWorkTemplateTable7ById(Long id)
    {
        return workTemplateTable7Mapper.selectWorkTemplateTable7ById(id);
    }

    /**
     * 查询纪检监察机关立案审查调查情况登记列表
     * 
     * @param workTemplateTable7 纪检监察机关立案审查调查情况登记
     * @return 纪检监察机关立案审查调查情况登记
     */
    @Override
    public List<WorkTemplateTable7> selectWorkTemplateTable7List(WorkTemplateTable7 workTemplateTable7)
    {
        return workTemplateTable7Mapper.selectWorkTemplateTable7List(workTemplateTable7);
    }

    /**
     * 新增纪检监察机关立案审查调查情况登记
     * 
     * @param workProgressBO 纪检监察机关立案审查调查情况登记
     * @return 结果
     */
    @Override
    public int insertWorkTemplateTable7(WorkProgressBO workProgressBO)
    {
        commonWorkTemplateTableService.insertOrUpdate(workProgressBO, "getWorkTemplateTable7", workTemplateTable7Mapper);
        return workProgressService.validate( workProgressBO.getWorkProgress());
    }

    /**
     * 修改纪检监察机关立案审查调查情况登记
     * 
     * @param workTemplateTable7 纪检监察机关立案审查调查情况登记
     * @return 结果
     */
    @Override
    public int updateWorkTemplateTable7(WorkTemplateTable7 workTemplateTable7)
    {
        workTemplateTable7.setUpdateBy(ShiroUtils.getLoginName());
        workTemplateTable7.setUpdateTime(DateUtils.getNowDate());
        return workTemplateTable7Mapper.updateWorkTemplateTable7(workTemplateTable7);
    }

    /**
     * 删除纪检监察机关立案审查调查情况登记对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWorkTemplateTable7ByIds(String ids)
    {
        return workTemplateTable7Mapper.deleteWorkTemplateTable7ByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除纪检监察机关立案审查调查情况登记信息
     * 
     * @param id 纪检监察机关立案审查调查情况登记ID
     * @return 结果
     */
    @Override
    public int deleteWorkTemplateTable7ById(Long id)
    {
        return workTemplateTable7Mapper.deleteWorkTemplateTable7ById(id);
    }

    /**
     *  查询纪检监察机关立案审查调查情况登记信息
     * @param progressId 工作进度id
     */
    @Override
    public List<WorkTemplateTable7> selectWorkTemplateTable7ByProgressId(Long progressId) {
        WorkTemplateTable7 workTemplateTable7 = new WorkTemplateTable7();
        workTemplateTable7.setProgressId(progressId);
        return  selectWorkTemplateTable7List(workTemplateTable7);
    }

    @Override
    public WorkTemplateTable7 selectWorkTemplateTableByProgressIdLimit1(Long progressId) {
        return  workTemplateTable7Mapper.selectWorkTemplateTableByProgressIdLimit1(progressId);
    }


}
